package com.cskaoyan.day2.collection._02_iteraror;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author Common-zhou
 * @since 2023-02-28 15:19
 */
public class Demo3 {
    public static void main(String[] args) {
        testForeach();
    }

    private static void testForeach() {
        Collection<String> collection = new ArrayList<>();

        collection.add("zs");
        collection.add("ls");
        collection.add("wu");

        // for循环
        // 也要注意并发修改异常
        for (String s : collection) {
            System.out.println(s);

            //if ("zs".equals(s)) {
            //    collection.remove("zs");
            //}
        }


    }
}
